package com.farsunset.webhook.feign.response;

import java.util.List;
import java.util.Map;

public class OpenAIResponse {

    private List<Choice> choices ;

    public List<Choice> getChoices() {
        return choices;
    }

    public void setChoices(List<Choice> choices) {
        this.choices = choices;
    }

    public String getText(){

        if (choices == null || choices.isEmpty()){
            return null;
        }

        String text = choices.get(0).text;

        return text == null ? null : text.replaceFirst("\n\n","");
    }

    public static class Choice{
        private String text;

        public String getText() {
            return text;
        }

        public void setText(String text) {
            this.text = text;
        }
    }
}
